package cn.wsn2018.tools.dao;


import cn.wsn2018.tools.model.Log.LogInfo;
import cn.wsn2018.tools.model.Log.LogsInfo;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.bson.Document;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LogsInfoDao {
    boolean saveLogsInfo(LogsInfo logsInfo);
    List<LogsInfo> listLogsByPageNum(int pageNum,int pageSize);
    List<LogsInfo> listLogsInfoByUser(String username,int pageNum,int pageSize);
    List<LogsInfo> listLogsInfoByTime(int pageNum,int pageSize,String fromTime,String toTime);
    List<LogsInfo> listLogsInfoByTimeAndName(String username,int pageNum,int pageSize,String fromTime,String toTime);
    List<LogsInfo> listLogsInfoByCond(String username,Integer eventType,int pageNum,int pageSize,String fromTime,String toTime,String timeSort,String usernameSort,String typeSort,String eventTypeSort);
    Long    countLogsInfoByCond(String username,String fromTime,String toTime,Integer evnetType);

    boolean saveLogInfo(LogInfo LogInfo,String collectionName);
    List<LogsInfo> listLogInfoByCond(String username,int pageNum, int pageSize, String fromTime, String toTime,Class className,String collectionName,String moduleNameSort,String typeSort,String levelSort,String timeSort, String errorModuleSort,String usernameSort,String operatTypeSort);
    Long coutLogInfoByCond(String username,String fromTime, String toTime,String collectionName);
    //方便日志转存，无条件查询所有日志
    List<LogsInfo> listAllLogsByCond(Class className,String collectionName);

    List<Document> statisticalBusLogs(String fromTime, String toTime, String name, Integer eventType);
    List<Document> statisticalWarnLogs(String fromTime, String toTime, String name, Integer warnType);
    List<Document> statisticalErrorLogs(String fromTime, String toTime, String name, Integer moduleType);

}
